package com.one.common.manager.imagepreview;

import android.graphics.Rect;
import android.os.Parcel;
import android.os.Parcelable;

import androidx.annotation.Nullable;

import com.previewlibrary.enitity.IThumbViewInfo;

/**
 * Author: zhulunjun
 * Email: zhulunjun@qq.com
 * CreateDate: 2018/12/25 15:46
 * Description：图片预览信息
 **/
public class ImagePreviewInfo implements IThumbViewInfo {

    private String path;
    private Rect bounds;
    private String videoUrl;

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public void setBounds(Rect bounds) {
        this.bounds = bounds;
    }

    public void setVideoUrl(String videoUrl) {
        this.videoUrl = videoUrl;
    }

    @Override
    public String getUrl() {
        return path;
    }

    @Override
    public Rect getBounds() {
        return bounds;
    }

    @Nullable
    @Override
    public String getVideoUrl() {
        return videoUrl;
    }


    public ImagePreviewInfo() {
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.path);
        dest.writeParcelable(this.bounds, flags);
        dest.writeString(this.videoUrl);
    }

    protected ImagePreviewInfo(Parcel in) {
        this.path = in.readString();
        this.bounds = in.readParcelable(Rect.class.getClassLoader());
        this.videoUrl = in.readString();
    }

    public static final Parcelable.Creator<ImagePreviewInfo> CREATOR = new Parcelable.Creator<ImagePreviewInfo>() {
        @Override
        public ImagePreviewInfo createFromParcel(Parcel source) {
            return new ImagePreviewInfo(source);
        }

        @Override
        public ImagePreviewInfo[] newArray(int size) {
            return new ImagePreviewInfo[size];
        }
    };
}
